import java.util.regex.Matcher
import java.util.regex.Pattern


def file;

if(this.args.size() < 1) {
	println "Please input source file name: ";
}


file = new File(this.args[0]);

def content = file.getText();

// remove throws multiple exceptions
content = Pattern.compile("throws ([^{])+", Pattern.DOTALL).matcher(content).replaceAll("throws Exception ");

// remove eclipse generated fake javadoc comment
new_content = Pattern.compile('/\\*([^/])+/', Pattern.DOTALL).matcher(content).replaceAll("");

// remove duplicated @Override
new_content = Pattern.compile('@Override.{0,20}@Override', Pattern.DOTALL).matcher(new_content).replaceAll("@Override");


new File("g:/a.java").write(new_content);

if(new_content.indexOf('void ') >= 0) {
  println 'Please give void method a default return value...........'
}


